package Thread;

import java.util.Timer;
import java.util.TimerTask;

public class MyTimerTask extends TimerTask {
    @Override
    public void run() {
        System.out.println("hello run");
    }

    public static void main(String[] args) {
        Timer timer = new Timer();
        MyTimerTask task = new MyTimerTask();
        System.out.println("hello main");
        timer.schedule(task, 1000, 2000);
    }
}
